@page "/Column_line_Combo_Chart"

<Tabs>
    <TabPane Key="1">
        <Tab>示例1</Tab>
        <ChildContent>
            <Button OnClick="OnRefreshClick">Refresh Data</Button>
            <ColumnLine @ref="chart1" TItem="object" Config="config1" />
        </ChildContent>
    </TabPane>
</Tabs>

@code{

    IChartComponent chart1;


    protected override void OnAfterRender(bool firstRender)
    {
        base.OnAfterRender(firstRender);
        if (firstRender)
        {
            chart1.ChangeData(new object[] { uvData, transformData });
        }

    }

    private void OnRefreshClick()
    {
        uvData = new object[]{
        new { time = "2019-03", value = 800 },
        new { time= "2019-04", value= 200 },
        new { time= "2019-05", value= 300 },
        new { time= "2019-06", value= 20 },
        new { time= "2019-07", value= 150 },
            };

        config1.Data = new object[] { uvData, transformData };
        chart1.UpdateConfig(config1);

        //chart1.ChangeData(new object[] { uvData, transformData} );



    }

    #region 示例1

    object uvData = new object[]{
        new { time = "2019-03", value = 350 },
        new { time= "2019-04", value= 900 },
        new { time= "2019-05", value= 300 },
        new { time= "2019-06", value= 450 },
        new { time= "2019-07", value= 470 },
    };

    object transformData = new object[]{
         new { time= "2019-03", count= 100 },
         new { time= "2019-04", count= 600 },
         new { time= "2019-05", count= 400 },
         new { time= "2019-06", count= 380 },
         new { time= "2019-07", count= 220 },
    };

    ColumnLineConfig config1 = new ColumnLineConfig()
    {
        Title = new Charts.Title()
        {
            Visible = true,
            Text = "柱线混合图",
        },
        Description = new Description()
        {
            Visible = true,
            Text = "柱线混合图表",
        },
        XField = "time",
        YField = new string[] { "value", "count" },
    };


    #endregion 示例1

}

